package com.cskaoyan.catmall.controller.wx;

import com.cskaoyan.catmall.model.vo.BaseRespVo;
import com.cskaoyan.catmall.model.vo.SearchHelperWx;
import com.cskaoyan.catmall.model.vo.SearchIndexWxVO;
import com.cskaoyan.catmall.service.Impl.SearchServiceWxImp;
import com.cskaoyan.catmall.service.SearchServiceWx;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @date: 2022-01-11-09-22
 * @author: ZYY
 * @description: 前台search接口的实现
 */
@RestController
@RequestMapping("wx")
public class SearchControllerWx {
    @Autowired
    SearchServiceWx searchService;

    @RequestMapping("search/index")
    public BaseRespVo searchIndex(){
        SearchIndexWxVO data = searchService.searchIndex();
        return BaseRespVo.ok(data);
    }

    @RequestMapping("search/helper")
    public BaseRespVo searchHelper(String keyword){
        SearchHelperWx data = searchService.searchHelper(keyword);
        return BaseRespVo.ok(data);
    }

    @RequestMapping("search/clearhistory")
    public BaseRespVo clearHistory(){
        int i = searchService.clearHistory();
        return BaseRespVo.ok();
    }
}